z=t=0;p='' for i in input(): if t>5or p>=i:t=0;z+=1 p=i;t+=1 print(z+1)